using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Fields
{
    /// <summary>
    /// <para>Calculate Fields </para>
    /// <para>Calculates the values of two or more fields for a feature class, feature layer, or raster.</para>
    /// <para>计算要素类、要素图层或栅格的两个或多个字段的值。</para>
    /// </summary>    
    [DisplayName("Calculate Fields ")]
    public class CalculateFields : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public CalculateFields()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The table containing the fields that will be updated with the new calculations.</para>
        /// <para>包含将使用新计算更新的字段的表。</para>
        /// </param>
        /// <param name="_expression_type">
        /// <para>Expression Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of expression that will be used.</para>
        ///   <bulletList>
        ///     <bullet_item>Python 3—The Python expression type will be used. This is the default.</bullet_item><para/>
        ///     <bullet_item>Arcade—The Arcade expression type will be used.</bullet_item><para/>
        ///     <bullet_item>SQL—The SQL expression type will be used.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>To learn more about Python expressions, see Calculate Field Python examples.</para>
        ///   <para>To learn more about Arcade expressions, see the ArcGIS Arcade guide.</para>
        ///   <para>To learn more about SQL expressions, see Calculate field values.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将使用的表达式的类型。</para>
        ///   <bulletList>
        ///     <bullet_item>Python 3 - 将使用 Python 表达式类型。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>Arcade—将使用 Arcade 表达式类型。</bullet_item><para/>
        ///     <bullet_item>SQL—将使用 SQL 表达式类型。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>若要了解有关 Python 表达式的详细信息，请参阅计算字段 Python 示例。</para>
        ///   <para>要了解有关 Arcade 表达式的详细信息，请参阅 ArcGIS Arcade 指南。</para>
        ///   <para>若要了解有关 SQL 表达式的详细信息，请参阅计算字段值。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_fields">
        /// <para>Fields</para>
        /// <para>The fields that will be calculated and their expressions.</para>
        /// <para>将要计算的字段及其表达式。</para>
        /// </param>
        public CalculateFields(object _in_table, _expression_type_value _expression_type, object _fields)
        {
            this._in_table = _in_table;
            this._expression_type = _expression_type;
            this._fields = _fields;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Calculate Fields ";

        public override string CallName => "management.CalculateFields";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_in_table, _expression_type.GetGPValue(), _fields, _code_block, _out_table, _enforce_domains.GetGPValue()];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The table containing the fields that will be updated with the new calculations.</para>
        /// <para>包含将使用新计算更新的字段的表。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Expression Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the type of expression that will be used.</para>
        ///   <bulletList>
        ///     <bullet_item>Python 3—The Python expression type will be used. This is the default.</bullet_item><para/>
        ///     <bullet_item>Arcade—The Arcade expression type will be used.</bullet_item><para/>
        ///     <bullet_item>SQL—The SQL expression type will be used.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>To learn more about Python expressions, see Calculate Field Python examples.</para>
        ///   <para>To learn more about Arcade expressions, see the ArcGIS Arcade guide.</para>
        ///   <para>To learn more about SQL expressions, see Calculate field values.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将使用的表达式的类型。</para>
        ///   <bulletList>
        ///     <bullet_item>Python 3 - 将使用 Python 表达式类型。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>Arcade—将使用 Arcade 表达式类型。</bullet_item><para/>
        ///     <bullet_item>SQL—将使用 SQL 表达式类型。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>若要了解有关 Python 表达式的详细信息，请参阅计算字段 Python 示例。</para>
        ///   <para>要了解有关 Arcade 表达式的详细信息，请参阅 ArcGIS Arcade 指南。</para>
        ///   <para>若要了解有关 SQL 表达式的详细信息，请参阅计算字段值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Expression Type")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public _expression_type_value _expression_type { get; set; }

        public enum _expression_type_value
        {
            /// <summary>
            /// <para>Python 3</para>
            /// <para>Python 3—The Python expression type will be used. This is the default.</para>
            /// <para>Python 3 - 将使用 Python 表达式类型。这是默认设置。</para>
            /// </summary>
            [Description("Python 3")]
            [GPEnumValue("PYTHON3")]
            _PYTHON3,

            /// <summary>
            /// <para>Arcade</para>
            /// <para>Arcade—The Arcade expression type will be used.</para>
            /// <para>Arcade—将使用 Arcade 表达式类型。</para>
            /// </summary>
            [Description("Arcade")]
            [GPEnumValue("ARCADE")]
            _ARCADE,

            /// <summary>
            /// <para>SQL</para>
            /// <para>SQL—The SQL expression type will be used.</para>
            /// <para>SQL—将使用 SQL 表达式类型。</para>
            /// </summary>
            [Description("SQL")]
            [GPEnumValue("SQL")]
            _SQL,

        }

        /// <summary>
        /// <para>Fields</para>
        /// <para>The fields that will be calculated and their expressions.</para>
        /// <para>将要计算的字段及其表达式。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Fields")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _fields { get; set; }


        /// <summary>
        /// <para>Code Block</para>
        /// <para><xdoc>
        ///   <para>A block of code that will be used for complex expressions.</para>
        ///   <para>A function cannot be used to return multiple values.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将用于复杂表达式的代码块。</para>
        ///   <para>一个函数不能用于返回多个值。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Code Block")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _code_block { get; set; } = null;


        /// <summary>
        /// <para>Output Table</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Table")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_table { get; set; }


        /// <summary>
        /// <para>Enforce Domains</para>
        /// <para><xdoc>
        ///   <para>Specifies whether field domain rules will be enforced.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—Field domain rules will be enforced. If a field cannot be updated, the field value will remain unchanged, and the tool messages will include a warning message.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Field domain rules will not be enforced. This is the default</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否强制执行字段域规则。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 将强制执行字段域规则。如果字段无法更新，则字段值将保持不变，并且工具消息将包含警告消息。</bullet_item><para/>
        ///     <bullet_item>未选中 - 将不强制执行字段域规则。这是默认设置</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Enforce Domains")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _enforce_domains_value _enforce_domains { get; set; } = _enforce_domains_value._false;

        public enum _enforce_domains_value
        {
            /// <summary>
            /// <para>ENFORCE_DOMAINS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ENFORCE_DOMAINS")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_ENFORCE_DOMAINS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_ENFORCE_DOMAINS")]
            [GPEnumValue("false")]
            _false,

        }

        public CalculateFields SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}